<%-- 
    Document   : searchresult
    Created on : Apr 5, 2012, 7:54:19 PM
    Author     : Ajay Kumar "Mukund"
--%>

<%@page import="jobportal.Dbconn"%>
<%@page import="java.sql.*" %>
<%try {
        Connection con = Dbconn.getConn();
        Statement st = con.createStatement();
        ResultSet rs;
        String keyword = "", title = "", skills = "", exp1 = "", qualif = "", location = "", role = "", employertype = "";
        if (request.getParameter("keyword") != null && !request.getParameter("keyword").equals("")) {
            keyword = "and metakeys like '%" + request.getParameter("keyword") + "%' ";
        }
        if (request.getParameter("title") != null && !request.getParameter("title").equals("")) {
            title = "and jobtitle like '%" + request.getParameter("title") + "%' ";
        }
        if (request.getParameter("skills") != null && !request.getParameter("skills").equals("")) {
            skills = "and keyskill like '%" + request.getParameter("skills") + "%' ";
        }
        if (request.getParameter("exp1") != null && !request.getParameter("exp1").equals("")) {
            exp1 = "and minexp>" + request.getParameter("exp1") + " ";
        }
        if (request.getParameter("qualif") != null && !request.getParameter("qualif").equals("")) {
            qualif = "and qualification like'%" + request.getParameter("qualif") + "%' ";
        }
        if (request.getParameter("location") != null && !request.getParameter("location").equals("")) {
            location = "and joblocation like '%" + request.getParameter("location") + "%' ";
        }
        if (request.getParameter("role") != null && !request.getParameter("role").equals("")) {
            role = "and jobrole='%" + request.getParameter("role") + "%' ";
        }
        if (request.getParameter("employertype") != null && !request.getParameter("employertype").equals("")) {
            employertype = "and emptype like '%" + request.getParameter("employertype") + "%'";
        }

        String sql = "select jobs.compid,jobid,jobtitle,minexp,maxexp,compname,desiredprof,keyskill,salary,walkindate,funarea,qualification,salarytype from jobs,company where jobs.compid=company.compid  and validuntil>=CURDATE() and jobs.status='Active'"
                + keyword + title + skills + exp1 + qualif + location + role + employertype;
        //out.println(sql);
        rs = st.executeQuery(sql);
        // out.println(sql);





%>






<%@include file="header.jsp" %>
<table border="0" cellspacing="0" cellpadding="0" style="width:100%; height:auto;">
    <tr>
        <td width="761" align="left" valign="top" style="padding-left:5px; padding-top:10px; padding-right:5px;">	<script src="checkall.js"></script>
            <div >
                <span class="mainheading"  style="padding-bottom:0px;">Job Result</span><img src="../images/blank.gif" alt="blank" width="18" height="17" border="0" /><br>
                <table width="99%" border="0" align="center" cellpadding="0" cellspacing="0">
                    <tr>
                        <td width="80%" style="padding-left:2px; padding-top:10px; padding-right:5px; padding-bottom:10px;">
                        </td></tr>
                </table>
                <div class="heading_line_hor"><!-- --></div></div><br>

            <table width="100%" border="0" cellspacing="0" cellpadding="0">
                <tr>
                    <td height="19">&nbsp;</td>
                </tr>
            </table>
            <%while (rs.next()) {%>
            <form name="form1" method="post" action="applyjob">
                <table width="100%" border="0" cellpadding="0" cellspacing="0" class="tblBorder">
                    <tr>
                        <td width="3%" ></td>
                        <td width="76%" height="25" align="left" valign="middle">
                            <span style="text-transform:capitalize;color: #004BD9;font-size: +2;vertical-align: middle" >
                                <%
                                    String exp = "";

                                    if (rs.getInt("minexp") == -1 && rs.getInt("maxexp") == -1) {
                                        exp = "Fresher";
                                    } else if (rs.getInt("minexp") == -1 && rs.getInt("maxexp") > 0) {
                                        exp = "0 to " + rs.getInt("maxexp") + " yrs";
                                    } else {
                                        exp = rs.getInt("minexp") + " to " + rs.getInt("maxexp") + " yrs";
                                    }
                                %>

                                <a href="viewjobdetails.jsp?jobid=<%=rs.getString("jobid")%>"><strong><img src="../src/getpic.jsp?id=<%=rs.getString("compid")%>&table=company&col=logo&pk_col=compid" width="105" height="47"/><%=rs.getString("jobtitle")%></strong>           </a>                </span>
                                        <%="(" + exp + ")"%>
                            <input type="hidden" name="jobid" value="<%=rs.getString("jobid")%>" />
                        </td>
                        <td >
                            <input type="submit" name="Submit" class="button2" value="Save Job"/>
                        </td>
                        <td style="padding-left: 5px">
                            <input type="submit" name="Submit" class="button2" value="Apply This Job">
                        </td>
                    </tr>

                    <tr>
                        <td>
                        </td>
                        <td colspan="2" align="left" valign="top" style="padding-top:4px;">
                            <%=rs.getString("compname")%><span style="padding-bottom:10Px;">
                                (<%=rs.getString("walkindate")%>)</span>
                        </td><td></td>
                    </tr>
                    <tr>
                        <td></td>
                        <td colspan="2" align="left" valign="top" style="padding-bottom:2px; padding-right:5px;">
		   Work Expereince :
                            <%=exp%></td><td></td>
                    </tr>
                    <tr>
                        <td></td>
                        <td colspan="2" align="left" valign="top" style="padding-bottom:2px;" >Key Skills :-<%=rs.getString("keyskill")%>  </td>
                        <td></td>
                    </tr>
                    <tr>
                        <td>&nbsp;</td>
                        <td colspan="2" align="left" valign="top" style="padding-bottom:2px;" >Functional Area :- <%=rs.getString("funarea")%> </td>
                        <td></td>
                    </tr>
                    <tr>
                        <td>&nbsp;</td>
                        <td colspan="2" align="left" valign="top" style="padding-bottom:2px;" >Salary :-
                            <%=rs.getString("salary")%>  <%=rs.getString("salarytype")%>           | <span style="padding-right:5px;">Walkin Date :-<%=rs.getString("walkindate")%>&nbsp;</span> </td>
                        <td></td>
                    </tr>

                    <tr>
                        <td></td>
                        <td colspan="2" align="left" valign="top" ><div class="spacer_line1" ><!-- --></div></td>
                        <td></td>
                    </tr>
                </table>
            </form>
            <br />
            <div style="padding-top:2px; padding-bottom:2px;"><!-- --></div>
            <%}%>
        </td>
    </tr>




</table>
<%
    } catch (Exception e) {
        out.println("exception::" + e);
    }
%>
<%@include file="footer.jsp" %>
<script>
    $(function() {
        $( "#msg" ).dialog();
    });
</script>



<%
    if (request.getAttribute("status") != null) {
%>
<div id="message"  title="Message">
    <%
        out.println(request.getAttribute("status"));
    %>
</div>
<%
        request.removeAttribute("status");
    }
%>
